package androidui.com.sj.newproject;

import android.os.Bundle;
import android.support.annotation.Nullable;

import android.util.Log;
import android.view.View;


import net.RestClient;
import net.RestCreator;
import net.RestService;
import net.callback.ISuccess;


import androidui.com.sj.latte.app.ConfigType;
import androidui.com.sj.latte.app.Latte;
import delegates.LatteDelegates;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by wzp on 2019/2/22 0022.
 * <p>
 * 描述  ：todo
 */

public class ExampleDelegate extends LatteDelegates {
    @Override
    public Object setLayout() {
        return R.layout.delegate_example;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootview) {


        RestClient.builder()
                .url("test/Test/Login")
                .loader(getContext())
                .success(new ISuccess() {
                    @Override
                    public void onSuccess(String response) {
                        Log.d("wzp",response);
                    }
                }).build()
                .get();








//        Call<String> call = RestCreator.getRestService().getTest("www", "123132");
//        call.enqueue(new Callback<String>() {
//            @Override
//            public void onResponse(Call<String> call, Response<String> response) {
//                Log.d("wzp123",response.body());
//            }
//
//            @Override
//            public void onFailure(Call<String> call, Throwable t) {
//
//            }
//        });
//        RestClient.builder()
//                .success(new ISuccess() {
//                    @Override
//                    public void onSuccess(String response) {
//
//                        Log.d("wzp",response);
//                    }
//                })
//              .build().get();


//        Retrofit retrofit =  new Retrofit.Builder()
//                .baseUrl("http://139.224.235.13/tp/zstp/public/")
//                .addConverterFactory(GsonConverterFactory.create())
//                .build();
//
//        RestService mApi = retrofit.create(RestService.class);
//        Call<String> call  = mApi.getTest("ww","13213");
//        Log.d("wzp","11111111111111");
//        call.enqueue(new Callback<String>() {
//            @Override
//            public void onResponse(Call<String> call, Response<String> response) {
//                Log.d("wzp123",response.body());
//            }
//
//            @Override
//            public void onFailure(Call<String> call, Throwable t) {
//                Log.d("wzpfailure",t.toString());
//            }
//        });



    }
}
